//
// Created by F1997 on 2025/4/22.
//

#ifndef NETWORK_TRAFFIC_PROCESSING_ETHER_HEADER_H
#define NETWORK_TRAFFIC_PROCESSING_ETHER_HEADER_H

#include "../utils/pch.h"

#pragma pack(push, 1)


struct ETHHEADER // 以太网报头
{
    char eh_dstmac[6];
    char eh_srcmac[6];
    short eh_type;
};
struct IPHEADER // ip报头
{
    unsigned char h_verlen;
    unsigned char tos;
    unsigned short total_len;
    unsigned short identification;
    unsigned short frag_and_flags;
    unsigned char ttl;
    unsigned char proto;
    unsigned short checksum;
    unsigned int sourceIP;
    unsigned int destIP;
};
struct UDPHEADER // udp报头
{
    unsigned short uh_srcport;
    unsigned short uh_dstport;
    unsigned short uh_len;
    unsigned short uh_chk;
};

typedef struct
{
    unsigned char 	Flag;					//协议标志
    char 			TypeID;					//协议版本
    unsigned short  Length;					//包长度
    unsigned short	PacketNo;				//全0
    unsigned int	ChangeNo;				//增量编号
    short			InstrumentNo;			//合约编码
    char			InstrumentID[10];		//合约
    unsigned int	UpdateTime;				//最后更新时间(秒)
    unsigned short	UpdateMillisec;			//最后更新时间(毫秒)
    int				Volume;
    int				OpenInterest;
    int				BidVolume1;
    int				BidVolume2;
    int				BidVolume3;
    int				BidVolume4;
    int				BidVolume5;
    int				AskVolume1;
    int				AskVolume2;
    int				AskVolume3;
    int				AskVolume4;
    int				AskVolume5;
    double			LastPrice;
    double			BidPrice1;
    double			BidPrice2;
    double			BidPrice3;
    double			BidPrice4;
    double			BidPrice5;
    double			AskPrice1;
    double			AskPrice2;
    double			AskPrice3;
    double			AskPrice4;
    double			AskPrice5;
    double			Turnover;
}Zbp05; // 5档行情

typedef struct
{
    ETHHEADER EthHead; // ethernet报头
    IPHEADER IpHead; // ip报头
    UDPHEADER UdpHead; // udp报头
    Zbp05 AmgBody; // 报文内容=5档行情
}Zbp05Udp; // 完整的udp报文

#pragma pack(pop)

#endif //NETWORK_TRAFFIC_PROCESSING_ETHER_HEADER_H
